package day06.JDK8Demo;

import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Date;

public class Lian05 {
    public static void main(String[] args) {
        Date date=new Date();
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        String s = sdf.format(date);
        System.out.println(s);
    }

    private static void method2() {
        String s="2020年11月11日 13:14:15";
        DateTimeFormatter pattern = DateTimeFormatter.ofPattern("yyyy年MM月dd日 HH:mm:ss");
        LocalDateTime parse = LocalDateTime.parse(s, pattern);
        System.out.println(parse);
    }

    private static void meehod1() {
        LocalDateTime time = LocalDateTime.of(2020, 1, 1, 1, 1, 1);
        DateTimeFormatter pattern = DateTimeFormatter.ofPattern("yyyy年MM月dd日 HH:mm:ss");
        String format = time.format(pattern);
        System.out.println(format);
    }
}
